<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="app">
        <su-nan></su-nan>
        <su-nan></su-nan>
        <su-nan></su-nan>
        <su-nan></su-nan>

        <jian-wei></jian-wei>
    </div>
    <script src="../js/vue.js"></script>
    <script>
        /* 组件 是一个可以复用的vue实例，组件中的配置项同Vue中的配置项基本类似，除了el（在组件中不用写） ,data是一个函数 
        
        */
        let sunan = {
            data() {
                return {
                    msg:'周坚伟很帅！！'
                }
            },
            template:'<div><p>{{msg}}</p><button @click="test">test</button></div>',
            methods: {
                test(){
                    console.log('111');
                }
            },
        }
        let jianwei = {
            data() {
                return {
                    msg:'张素楠很漂亮！！'
                }
            },
            template:'<div>{{msg}}</div>'
        }
        let vm = new Vue({
            el:'#app',
            data:{

            },
            components:{
                'su-nan':sunan,
                'jian-wei':jianwei
            }
        })
    </script>
</body>
</html>